package com.briup.day22;

/**
 * @author ThinkBook
 */
public class Test06_Thread {
    public static void main(String[] args) {
        //创建子线程对象
        MyThread myThread = new MyThread();
        //启动子线程
        myThread.start();
        //循环输出0-99
        for (int i = 0;i<=99;i++){
        System.out.println("in main i: " + i);
        }
        Thread thread = new Thread(){
            @Override
          public void run(){
              for (int i =199;i>=100;i--){
                  System.out.println("in thread run, i: " + i);
              }
          }
        };
        thread.start();
    }
}
//定义子线程类
class MyThread extends Thread{
    //重写run方法
    @Override
    public void run(){
        //输出199-100
        for(int i = 199; i >= 100; i--) {
            System.out.println("in MyThread run, i：" + i);
        }
    }

}
